@page
@using Microsoft.AspNetCore.Authorization
@model Passwordless.AdminConsole.Pages.Organization.Join
@attribute [AllowAnonymous]
@{
    ViewBag.Title = "Join an organization";
}

@if (Model.Invite == null)
{
    <div asp-validation-summary="All"></div>
}
else
{
    <div class="sm:w-full sm:max-w-xl">
        <p>You've been invited by @Model.Invite.FromName (@Model.Invite.FromEmail) to join @Model.Invite.TargetOrgName.</p>
        <info-alert-box message="Please make sure to <strong>use a unique email address</strong> that is not already connected to an organization."></info-alert-box>

        <div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10 mt-4">
            <form method="post" class="space-y-6">

                <div>
                    <label asp-for="Form.Name" class="block text-sm font-medium leading-6 text-gray-900">Admin Name</label>
                    <div class="mt-2">
                        <input placeholder="Philip J. Fry" type="text" asp-for="Form.Name" class="text-input">
                        <span asp-validation-for="Form.Name"></span>
                    </div>
                </div>

                <div>
                    <label asp-for="Form.Email" class="block text-sm font-medium leading-6 text-gray-900">Admin Email</label>
                    <div class="mt-2">
                        <input placeholder="pjfry@@example.org" type="text" asp-for="Form.Email" class="text-input">
                        <span asp-validation-for="Form.Email"></span>
                    </div>
                </div>

                <div class="relative flex items-start">
                    <div class="flex h-6 items-center">
                        <input aria-describedby="tos-description" asp-for="Form.AcceptsTermsAndPrivacy" type="checkbox">
                    </div>
                    <div class="ml-3 text-sm leading-6">
                        <label asp-for="Form.AcceptsTermsAndPrivacy" class="font-medium text-gray-900">I agree to the <a href="https://bitwarden.com/terms/" class="link-blue" target="_blank">Terms and Conditions</a> and the <a href="https://bitwarden.com/privacy/" class="link-blue" target="_blank">Privacy Policy</a></label>
                    </div>
                </div>

                <input type="hidden" asp-for="Form.Code"/>
                <div asp-validation-summary="ModelOnly"></div>
                <div>
                    <button type="submit" class="btn-form">Join</button>
                </div>
            </form>
        </div>
    </div>
}